﻿@model RBS.Core.Model.Hotel.H_Hotel_Cookbook
@{
    ViewBag.Title = "内容页";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
 
<script type="text/javascript">

    $(function() {
        $('#inputCaiXi').combotree({
            url: '/Cookbook/GetCaiXiTree',
            method: 'post',
            cascadeCheck: false,
            //multiple: true,
            //required: false,
            //选择树节点触发事件  
            onSelect: function(node) { 
                var tree = $(this).tree; 
                $("#Cuisine").val(node.id);
            },
            onChange: function(newValue, oldValue) { 
            }
        });
        //设置菜系
        $('#inputCaiXi').combotree('setValue', "@Model.Cuisine"); 
        $("#submitImg").click(function() {
            if ($("#dishImg").val().length > 0) {
                ajaxFileUpload();
            } else {
                alert("请选择要上传的文件！");
            } 
        });

        $("#Price").blur(function () { 
            $("#Discount").val(this.value);
        });
        
        $("#DiscountSelect").change(function () {
            //alert(this.value);
          
            $("#Discount").val((this.value * $("#Price").val()).toFixed(1));
        }); 
    }); 
    function ajaxFileUpload() {
        $.ajaxFileUpload(
            {
                url: '@Url.Action("UploadImg")', //用于文件上传的服务器端请求地址
                secureuri: false, //一般设置为false
                fileElementId: 'dishImg', //文件上传空间的id属性  <input type="file" id="file" name="file" />
                dataType: 'HTML', //返回值类型 一般设置为json
                success: function (data, status)  //服务器成功响应处理函数
                {
                    $("#img1").attr("src", "../../" + data);
                    $("#showimg").attr("href", "../../" + data);
                    //$("#Hotels_License").val(data);
                    $("#DishImages").val(data);
                    if (typeof (data.error) != 'undefined') {
                        if (data.error != '') {
                            alert(data.error);
                        } else {
                            alert(data.msg);
                        }
                    }
                },
                error: function (data, status, e)//服务器响应失败处理函数
                {
                    alert(e);
                }
            }
        );
    } 
    $(document).ready(function () {
        $(".upload-img").each(function () {
            $(this).InitSWFUpload({ sendurl: "@Url.Action("UploadImg")", flashurl: "@Url.Content("~/scripts/swfupload/swfupload.swf")" });
        });
    });
     
</script> 
<!--导航栏-->
@{
    @Html.Partial("_Location");
}
<!--/导航栏--> 
<!--内容-->
<div class="content-tab-wrap">
    <div id="floatHead" class="content-tab">
        <div class="content-tab-ul-wrap">
            <ul>
                <li><a href="javascript:;" onclick="tabs(this);" class="selected">基本信息</a></li>
               @* <li><a href="javascript:;" onclick="tabs(this);">扩展信息</a></li>*@
            </ul>
        </div>
    </div>
</div> 
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true) 
    @Html.HiddenFor(model => model.Id)
    <div class="tab-content">
        <dl>
            <dt>商品分类</dt>
            <dd>
                <div class="rule-single-select">
                    @Html.DropDownListFor(model => model.CategoryId, (SelectList)ViewBag.Category, "请选择菜谱分类..", htmlAttributes: new { datatype = "*", errormsg = "请选择菜谱分类！", sucmsg = " " }) 
                </div> 
            </dd>
        </dl> 
        <dl>
          <dt>名称</dt>
            <dd> 
                @Html.TextBoxFor(model => model.Name, null, new { @class = "input normal", datatype = "*1-10", errormsg = "填写名称！", sucmsg = " " })
                <span class="Validform_checktip">*名称</span> 
            </dd>
        </dl>
        <dl>
            <dt>单价</dt>
            <dd> 
                @Html.TextBoxFor(model => model.Price, null, new { @class = "input small", datatype = @"/^-?(([0-9]\d*)(\.\d{1,2})?)$|(0\.0?([1-9]\d?))$  /", errormsg = "填写单价！", sucmsg = " " })元
                   <div class="rule-single-select">
                    @Html.DropDownListFor(model => model.Unit, (SelectList)ViewBag.CBUnits, "单位", htmlAttributes: new { datatype = "*", errormsg = "请选择单位！", sucmsg = " " })
                </div>
                <span class="Validform_checktip">*时价商品价格设置为0，结算时由服务员进行价格和斤数的填写</span>
            </dd>
        </dl> 
         
     @*   <dl>
            <dt>特价标识</dt>
            <dd>   <div class="rule-multi-radio">  
                  <label for="Special">否</label>
                   @Html.RadioButtonFor(model => model.Special, 0, new { @id = "radio1", @name = "Special", @checked = "checked" })  
                  <label for="Special">是</label>
                                   @Html.RadioButtonFor(model => model.Special, 1, new { @id = "radio1", @name = "Special" })  
                   <span class="Validform_checktip">*特价标识</span> 
                </div>
            </dd>
        </dl> 
        <dl>
            <dt>打折标识</dt>
            <dd> 
                @Html.TextBoxFor(model => model.Discount, null, new { @class = "input small" })
                <div class="rule-single-select">
                    @{
                    List<SelectListItem> list = new List<SelectListItem> { 
                      new SelectListItem { Text = "请选择折扣", Value = "1"},
                    new SelectListItem { Text = "98折", Value = "0.98"},
                    new SelectListItem { Text = "95折", Value = "0.95" },
                    new SelectListItem { Text = "9折", Value = "0.90" },
                    new SelectListItem { Text = "88折", Value = "0.88" },
                    new SelectListItem { Text = "85折", Value = "0.85" },
                    new SelectListItem { Text = "8折", Value = "0.80" },
                    new SelectListItem { Text = "75折", Value = "0.75" }
                    };
                }
                    @Html.DropDownList("DiscountSelect",list) 
                </div>
            </dd>
        </dl> *@
        <dl>
            <dt>规格</dt>
            <dd>

                @Html.TextBoxFor(model => model.Component, null, new { @class = "input normal" })
                <span class="Validform_checktip">*规格</span>

            </dd>
        </dl>
        <dl>
            <dt>商品图片</dt>
            <dd> 
                 @Html.TextBoxFor(model => model.DishImages, null, new { @class = "input normal upload-path" }) 
                       @*  <img id="ImgPresss" width="169" height="44" class="upload-img1" alt=""/>*@
				        <div class="upload-box upload-img"></div> 
            </dd>
        </dl>

    </div>
    <div class="tab-content" style="display: none">
        <dl>
            <dt>烹调权重</dt>
            <dd> 
                @Html.TextBoxFor(model => model.CookingWeights, null, new { @class = "input small", datatype = "n0-100", })
                <span class="Validform_checktip">*请输入0-100的数字，数值越高权重越高</span>

            </dd>
        </dl>
        @*<dl>
            <dt>点菜权限</dt>
            <dd> 
                @Html.TextBoxFor(model => model.Permissions, null, new { @class = "input normal" })
                <span class="Validform_checktip">*点菜权限</span>

            </dd>
        </dl>*@
       @* <dl>
            <dt>擅长厨师</dt>
            <dd>

                @Html.TextBoxFor(model => model.GoodCook, null, new { @class = "input normal" })
                <span class="Validform_checktip">*擅长厨师</span>

            </dd>
        </dl>*@ 
        @*<dl>
            <dt>估清标识</dt>
            <dd> 
                 <div class="rule-multi-radio">  
                             <label for="EstimateClear">否</label>
                      @Html.RadioButtonFor(model => model.EstimateClear, -1, new { @id = "radio1", @name = "rdolstState", @checked = "checked" })  
                        <label for="EstimateClear">是</label>
                                   @Html.RadioButtonFor(model => model.EstimateClear, 1, new { @id = "radio1", @name = "rdolstState" })    
                  </div>
                <span class="Validform_checktip">*估清标识</span>

            </dd>
        </dl>*@
        <dl>
            <dt>合并烹调数量</dt>
            <dd> 
                @Html.TextBoxFor(model => model.CookingNumber, null, new { @class = "input small" })
                <span class="Validform_checktip">*合并烹调数量 (为0表示不可以合并)</span>

            </dd>
        </dl>
        <dl>
            <dt>启动标识</dt>
            <dd> 
              
                  <div class="rule-multi-radio">  
                             <label for="StartIdentification">即起</label>
                      @Html.RadioButtonFor(model => model.StartIdentification, 0, new { @id = "radio1", @name = "rdolstState" })  
                        <label for="StartIdentification">烹饪</label>
                                   @Html.RadioButtonFor(model => model.StartIdentification, 1, new { @id = "radio1", @name = "rdolstState" })    
                  </div>
                <span class="Validform_checktip">*启动标识 (针对汤凉菜等)</span> 
            </dd>
        </dl>


    </div>
    <!--/内容-->

    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-list">
            <input type="submit" value="提交保存" class="btn" />
            <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />

        </div>
        <div class="clear"></div>
    </div>
    <!--/工具栏-->
        
}



